One aspect of the field of software testing focuses on creating test scripts which drive the testing of graphical user interface programs (GUI programs). A GUI program is a program that provides functionality which is not accessible from a command line but is accessible through the program's graphical user interface. A test script is a series of commands that instruct the GUI program to generate simulated events. The simulated events are then processed by the GUI program The result of the processing is used to test whether the GUI program is working as expected.
Before describing prior art methods for creating test scripts, it may be helpful to have a more detailed understanding of how test scripts drive the testing process. FIG. 1 illustrates a computer system 100 for testing a GUI program 101 using automated testing techniques found in the prior art. The computer system 100 includes a display device 103, a storage device 105, an input device 107, and a computer 109. The computer includes an interface 111, a processor 113, and a computer memory 115. The computer memory includes the GUI program 101, a display server 117, and a test script 119.
One prior art testing method simulates input events (such as mouse clicks) in order to test the same data processing paths that are invoked in response to actual user input. In particular, the prior art testing method invokes the test script 119 which contains commands that instruct the GUI program 101 to generate a simulated event. For example, a test script command may instruct the GUI program to create an event simulating a user's "double-lick" in a button on a graphical user interface ("GUI") 120. When the GUI program completes its processing of the simulated event, the method saves the current state of the GUI 120 (a.k.a., saving a "snapshot" of the GUI). The saved information is then used at a later point to test whether the GUI program is working properly.
One prior art method for automatically creating test scripts begins by having a user enter data through the GUI 120 using the input device 107. For example, the user may press a mouse button while a mouse cursor is over a "File Open" entry in a command menu. The user data is sent to an operating system 121. The operating system examines the data, determines that it was entered on the graphical user interface 120, and sends the data to the display server 117. The display server 117 manages input and output on the graphical user interface. The display server receives the user data and creates an appropriate event. An event is a data structure that stores information regarding user actions on the graphical user interface. Typical events are a "ButtonPress" event and a "ButtonRelease" event. The event typically stores data indicating the absolute coordinates on the GUI 120 where the user action took place.
Once the event is created the display server 117 stores the event in a queue 123 where it can be retrieved and processed by the GUI program 101. At the same time the display server stores the event in the queue, the display server sends to a test script generater 125 information about the user action and about the absolute coordinates on the GUI 120 at which the user action took place. The test script generater takes the information, creates a corresponding command, and stores the command in a test script 119. The command instructs the GUI program 101 to perform the action at the absolute coordinates. In this way, the prior art automates test script generation.
The developers of the present invention recognized a problem with the prior art methods. In short, instructing the GUI program 101 to perform an action at specified coordinates on the GUI 120 is insufficient to ensure that the action will be successfully completed. If the method performs an action at the specified coordinates but the widget within which the action takes place is not currently displayed at those coordinates (e.g., it is not yet displayed at those coordinates or is currently displayed at other coordinates), then the action will fail. Assume that the method wants to perform a "Button Press" operation while a mouse cursor is over a "File Open" entry in a command menu. If the GUI program performs the "Button Press" operation at the appropriate coordinates but performs the operation when the command menu is not displayed at those coordinates, the Button Press operation will fail to open the file.
It would be beneficial to have a method and system that overcomes the limitations of the prior art